<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-member-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">昵称：</label>
				<div class="col-sm-8">
					<input id="accountName" name="accountName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用户名：</label>
				<div class="col-sm-8">
					<input id="memberName" name="memberName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">性别：</label>
				<div class="col-sm-8">
					<select id="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
						<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">年龄：</label>
				<div class="col-sm-8">
					<input id="age" name="age" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">生日：</label>
				<div class="col-sm-8">
					<input id="birthday" name="birthday" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">手机：</label>
				<div class="col-sm-8">
					<input id="phone" name="phone" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">邮件：</label>
				<div class="col-sm-8">
					<input id="mail" name="mail" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">微信号：</label>
				<div class="col-sm-8">
					<input id="wechat" name="wechat" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">OPENID：</label>
				<div class="col-sm-8">
					<input id="openid" name="openid" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">QQ：</label>
				<div class="col-sm-8">
					<input id="qq" name="qq" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">地址：</label>
				<div class="col-sm-8">
					<input id="address" name="address" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">职业：</label>
				<div class="col-sm-8">
					<input id="vocation" name="vocation" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">用户描述：</label>
				<div class="col-sm-8">
					<input id="memberDesc" name="memberDesc" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="onoffswitch">
						<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="status" name="status">
						<label class="onoffswitch-label" for="status">
							<span class="onoffswitch-inner"></span>
							<span class="onoffswitch-switch"></span>
						</label>
					</div>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "foxwash/member"
		$("#form-member-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            //$.operate.save(prefix + "/add", $('#form-member-add').serialize());
				add();
	        }
	    }
        function add() {
            accountName,memberName,sex,age,birthday,phone,mail,wechat,openid,qq,address,vocation,memberDesc,remark,status
            var accountName = $("input[name='accountName']").val();
            var memberName = $("input[name='memberName']").val();
            var age = $("input[name='age']").val();
            var birthday = $("input[name='birthday']").val();
            var phone = $("input[name='phone']").val();
            var mail = $("input[name='mail']").val();
            var wechat = $("input[name='wechat']").val();
            var openid = $("input[name='openid']").val();
            var qq = $("input[name='qq']").val();
            var address = $("input[name='address']").val();
            var vocation = $("input[name='vocation']").val();
            var memberDesc = $("input[name='memberDesc']").val();
            var remark = $("input[name='remark']").val();
            var sex = $("#sex option:selected").val();
            var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
            $.ajax({
                cache : true,
                type : "POST",
                url : prefix + "/add",
                data : {
                    "accountName": accountName,
                    "memberName": memberName,
                    "age": age,
                    "birthday": birthday,
					"phone": phone,
                    "mail": mail,
                    "wechat": wechat,
                    "openid": openid,
                    "qq": qq,
                    "address": address,
                    "vocation": vocation,
                    "memberDesc": memberDesc,
                    "remark": remark,
                    "sex": sex,
                    "status": status
                },
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.successCallback(data);
                }
            });
        }
	</script>
</body>
</html>
